import * as types from './types'
import axios from 'axios'
import '@/mock'

const book = {
  // 命名空间 起个名字
  namespaced: true,
  state: {
    bookStore: []
  },
  mutations: {
    // 函数名字都采用常量；
    [types.GET_BOOK_DATA](state, data) {
      state.bookStore = data;
    },

  },
  actions: {
    async update_Book({ commit }, data) {
      let bookList = await axios.get('/api/book')
      commit(types.GET_BOOK_DATA, bookList.data)
    }
  },
  modules: {
  }
}

export {
  book
}
